/**
 * 
 */
package com.net.job;

import java.util.List;
import java.util.Map;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Component;

import com.net.model.UserFlow;
import com.net.model.UserFlowStatData;
import com.net.service.pack.PackageService;
import com.net.util.SpringUtils;

/**
 *
 * @author fengcheng
 * @date 2018年6月26日 下午7:31:32
 */
@Component
public class IpScanJob {
	public void getIp(){
		System.out.println("IpScanJob``````````");
		UserFlowStatData userFlowStatData = SpringUtils.getBean("user_flow_data");
		System.out.println("执行IpScanJob前数据：" + userFlowStatData);
		PackageService packageService = SpringUtils.getBean("packageService");
		Map<String, UserFlow> data = userFlowStatData.getData();
		UserFlow userflow = new UserFlow();
		List<String>ips=packageService.getIp();
		for(String ip : ips){
			if(data.get(ip) == null){
				data.put(ip, userflow);
			}
		}
		userFlowStatData.setData(data);
		userFlowStatData = SpringUtils.getBean("user_flow_data");
		System.out.println("执行IpScanJob后数据：" + userFlowStatData);
	}
}
